﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace EasyPayDemo.WeiPay
{
    public class ExcuteTradeQuery : IFunction
    {
        public override void Execute()
        {

            M_TradeQuery request = new M_TradeQuery();
            request.orgId = WeiPayConfig.orgId;
            request.orgMercode = WeiPayConfig.orgMercode;
            request.orgTermno = WeiPayConfig.orgTermno;
            request.signType = WeiPayConfig.SIGN_TYPE_RSA256;

            request.orgTrace = WeiPayUtils.GetOrgTrace(WeiPayConfig.orgId);

            M_TradeQuery.Data dataBean = new M_TradeQuery.Data();

            dataBean.oriOrgTrace = request.orgTrace;
            request.data = dataBean;

            var chkStr = WeiPayUtils.GetSignData<M_TradeQuery.Data>(dataBean);
            string sign = EncryptionUtil.RSASignJavaBouncyCastle(chkStr.ToString(), WeiPayConfig.PrivateKey, "SHA256withRSA");
            request.sign = sign;

            var result = HttpPost<M_TradeQuery>(WeiPayConfig.ApiUrlTradeQuery, request);


        }
    }
}
